<?php

/**
 * Player filter form base class.
 *
 * @package    raidpoints
 * @subpackage filter
 * @author     David Driscoll
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePlayerFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fullname'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'altid'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Player'), 'add_empty' => true)),
      'guildedflag' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'safeflag'    => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'classid'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PClass'), 'add_empty' => true)),
      'genderid'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Gender'), 'add_empty' => true)),
      'raceid'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Race'), 'add_empty' => true)),
      'rankid'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Rank'), 'add_empty' => true)),
      'created_by'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'updated_by'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('sfGuardUser'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'name'        => new sfValidatorPass(array('required' => false)),
      'fullname'    => new sfValidatorPass(array('required' => false)),
      'altid'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Player'), 'column' => 'id')),
      'guildedflag' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'safeflag'    => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'classid'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('PClass'), 'column' => 'id')),
      'genderid'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Gender'), 'column' => 'id')),
      'raceid'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Race'), 'column' => 'id')),
      'rankid'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Rank'), 'column' => 'id')),
      'created_by'  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'updated_by'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('sfGuardUser'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('player_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Player';
  }

  public function getFields()
  {
    return array(
      'id'          => 'Number',
      'name'        => 'Text',
      'fullname'    => 'Text',
      'altid'       => 'ForeignKey',
      'guildedflag' => 'Boolean',
      'safeflag'    => 'Boolean',
      'classid'     => 'ForeignKey',
      'genderid'    => 'ForeignKey',
      'raceid'      => 'ForeignKey',
      'rankid'      => 'ForeignKey',
      'created_by'  => 'Number',
      'updated_by'  => 'ForeignKey',
    );
  }
}
